;$(function (){
    var goods_id = GetQueryString("goods_id");
    $.ajax({
        url: ApiUrl + "/index.php?act=goods&op=goods_detail",
        data: {goods_id: goods_id},
        type: "get",
        dataType: 'json',
        success: function(result) {
        	console.log(result.datas);
        	var data = result.datas;	
            //处理商品图片
            if(data.goods_image){
              var goods_image = data.goods_image.split(",");
              var length=goods_image.length;
              var temp=parseInt(length*Math.random());
              var goods_img = goods_image[temp];
              $(".goods_img").attr('src',goods_img);
            }else{
               data.goods_image = [];
            }
            $('.goods_name').html(data.goods_info.goods_name);//goods_price
            $('.goods_price').text(data.goods_info.goods_price);
            $('.goods_salenum').text(data.goods_info.goods_salenum);
            $('.goods_marketprice').text(data.goods_info.goods_marketprice);
            $('.goods_freight').text(data.goods_info.goods_freight);
            if(parseInt(data.goods_info.goods_freight) ==0){
            	$('.goods_freight').text(data.goods_info.goods_freight);
            }else{
            	$('.goods_freight').text('0.00');
            }
            if(data.goods_info.brabd_name){
            	$('.brabd_name').text(data.goods_info.brabd_name);
            }else{
            	$('.brabd_name').text('暂无');
            }
            if(data.goods_info.goods_from){
            	$('.goods_from').text(data.goods_info.goods_from);
            }else{
            	$('.goods_from').text('暂无');
            }
            $('.goods_storage').text(data.goods_info.goods_storage);
            if(data.goods_info.goods_package){
            	$('.goods_package').text(data.goods_info.goods_package);
            }else{
            	$('.goods_package').text('暂无');
            }
            if(data.goods_info.goods_quality){
            	$('.goods_quality').text(data.goods_info.goods_quality);
            }else{
            	$('.goods_quality').text('暂无');
            }
            
            if(data.store_info.store_name){
            	$('.store_name').text(data.store_info.store_name);
            }else{
            	$('.store_name').text('暂无');
            }
            
            if(data.goods_info.taste){
            	$('.taste').text(data.store_info.taste);
            }else{
            	$('.taste').text('暂无');
            }
            
    	}

    });
});

